#version 460
#extension GL_GOOGLE_include_directive : enable
#extension GL_EXT_shader_explicit_arithmetic_types_int64 : require

#include "../../../../core/shader_binding_ID.h"
#include "../../../../core/shader_std.h"
#include "../../../../core/shader_taster_transform.h"
#include "../../../../core/shader_taster_color.h"
#include "../../../../core/shader_taster_line.h"


layout(location = 0) in vec3 inPos;
layout(location = 1) in vec3 inNormal;
layout(location = 2) in vec2 inUV;


layout(location = 0) out vec4 vColor;
layout(location = 1) out flat int vUV;
layout(location = 2) out flat uint vDrawType;
layout(location = 3) out flat float vDepthOffset;
layout(location = 4) out flat float vIntensity;
out gl_PerVertex {
	vec4 gl_Position;
	float gl_PointSize;
};


void main(void){
	mat4 bonesMat_som = mat_Model[gl_InstanceIndex];
	//固定顶点坐标
	vec4 p = bonesMat_som * vec4(inPos, 1.0);
	
	S_MeshTranformProp prop = m_LinesProp[drawProp.MeshPropOffset + gl_DrawID];

	vColor.rgb = inNormal;
	vUV = int(inUV.x);
	vDrawType = prop.m_TransformMode;
	vDepthOffset = prop.m_DepthScale;
	vIntensity = inUV.y;

	gl_Position = mat_ProjecView[0] * p;
	gl_PointSize = (1.0 / (gl_Position.z * 0.1 + 1)) * prop.m_ZScale;
	gl_PointSize *= prop.m_Scale;
}


 